Bug Fix NXOS#387
Conversation
4864906 to
428cfa6
Compare
428cfa6 to
b4a3f78
Compare
cacc60c to
9b5c676
Compare
498d9d1 to
aa6a1cc
Compare
aa6a1cc to
87fbf1e
Compare
| FileSystemNotFoundError: When the module is unable to determine the default file system. | ||
| """ | ||
| raw_data = self.show("dir", raw_text=True) | ||
| self.open() |
There was a problem hiding this comment.
Why are we calling self.open() in seemingly random places? Is this working around timeouts not being handled correctly?
There was a problem hiding this comment.
Netmiko seems to be handling this fine so I'm going to remove these redundant self.open() calls:
>>> nxos.check_file_exists("system.bin")
2026-05-18 15:34:01,174 [ERROR] paramiko.transport: Socket exception: Connection reset by peer (104)
2026-05-18 15:34:03,854 [INFO] paramiko.transport: Connected (version 2.0, client OpenSSH_6.2)
2026-05-18 15:34:04,476 [INFO] paramiko.transport: Auth banner: b'C\ntest banner\n'
2026-05-18 15:34:04,476 [INFO] paramiko.transport: Authentication (password) successful!
| import unittest | ||
|
|
||
| import mock | ||
| from hypothesis import given |
There was a problem hiding this comment.
In a prior PR I asked that we stick with testing patterns that the team is familiar with. Please remove hypothesis.
gsnider2195
left a comment
There was a problem hiding this comment.
We need to address some feedback before merging this
|
Tested the updated commands against a device in the lab: |
| def test_get_free_space_raises_on_parse_error(self): | ||
| """Test _get_free_space raises CommandError when output can't be parsed.""" | ||
| mock_show.return_value = "Directory of bootflash:/\nNo free space info here\n" | ||
| self.device.native_ssh.send_command.return_value = "Directory of bootflash:/\nNo free space info here\n" |
There was a problem hiding this comment.
"Directory of ..." is an IOS command output but is fine for this test.
|
These are the functions that need to be updated to use Netmiko to support OS Upgrades:
These are all staged locally but need unit tests written. |
- _image_booted - _wait_for_device_reboot - uptime - hostname - redundancy_state - reboot - set_boot_options Removed caching for the uptime and uptime_string properties Added an NXOSDevice.show_netmiko method and added a deprecation warning to the existing NXOSDevice.show method
|
@jtdub this one should be ready for another review |
|
I updated the NXOSDevice.os_version task to use netmiko. |
…yntc into u/mattmiller/nxos_bugfix
987724b to
98acc63
Compare
New Pull Request
I am solving three bugs when running
nxos_device.py:nativeinstead ofnative_sshChange Notes
Fixed
_build_url_copy_command_simpleto return a string.Fixed
_get_file_systemand_get_free_spaceto use native_ssh; initial intent when created.Fixed the
remote_file_copyprompts to detect needing to enter a vrf if one isn't provided.Justification
The copy command return from
_build_url_copy_command_simpleshould not be a tuple.remote_file_copymethod is using native_ssh and _get_file_systemand_get_free_spaceshould be using it too.remote_file_copy` may return a prompt we were not catching previously.Note: unittest changes were written with AI